package com.ctos.ojbackendquestionservice.controller.inner;

import com.ctos.ojbackendmodel.entity.Question;
import com.ctos.ojbackendmodel.entity.QuestionSubmit;
import com.ctos.ojbackendquestionservice.service.QuestionService;
import com.ctos.ojbackendquestionservice.service.QuestionSubmitService;
import com.ctos.ojbackendserviceclient.service.QuestionFeignClient;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/inner")

public class QuestionInnerController implements QuestionFeignClient {

    @Resource
    private QuestionService questionService ;
    @Resource
    private QuestionSubmitService questionSubmitService; ;

    @Override
    @GetMapping("/get/id")
    public Question getQuestionById(@RequestParam("questionId") long questionId){
        return questionService.getById(questionId);
    }
    @Override
    @GetMapping("/question_submit/get/ids")
    public  QuestionSubmit getQuestionSubmitById(@RequestParam("questionSubmitId") long questionSubmitId){
        return questionSubmitService.getById(questionSubmitId);
    }
    @Override
    @PostMapping("/question_submit/update")
    public  boolean updateQuestionSubmitById(@RequestBody QuestionSubmit questionSubmit){
        return questionSubmitService.updateById(questionSubmit);
    }


}


